package sharewithus.content.service;

import java.util.List;

import sharewithus.business.dto.RelationShipMsg;
import sharewithus.content.dto.Feed;
import sharewithus.content.dto.FeedEx;

public interface IContentService {
	
	/**
	 * 
	 * @param feed
	 * call Persistence layer to save feed,  it can be saved to db or cache 
	 */
	public void saveFeed(Feed feed);
	
	
	/**
	 * 
	 */
	public void makeFeedSearchIndex(Feed feed);
	
	
	/**
	 * 
	 * @param feed
	 * @param followRelationships
	 * call Persistence layer save feed-subscriber relationship to, it can be saved to 
	 * db or cache.
	 */
	public void pushFeeds2Subscribers(Feed feed, List<RelationShipMsg> followRelationships);
	
	/**
	 * pull all the feeds and the new follower relationship 
	 * it can be persistent in db or cache
	 * @param feeds
	 * @param newFollowMsg
	 */
	public void pullFeeds(List<Feed> feeds, RelationShipMsg newFollowMsg);
	
	/**
	 * pull the feed to save in the owner's feed list in order to 
	 * allow user to make quick read of the owner's all feeds
	 * @param feed
	 */
	public void pushUserFeed(Feed feed);
	
	/**
	 * get all the feeds that belong to the given user that identified by ownerId
	 * @param ownerId
	 * @return
	 */
	public List<Feed> getUserFeeds(String ownerId);
	
	/**
	 *  get all the feeds that belong to the given user that identified by ownerId
	 *  base on the pagination
	 * @param ownerId
	 * @param pagination
	 * @param pageSize
	 * @return
	 */
	public List<Feed> getUserFeeds(String userId, int pagination, int pageSize);
	
	/**
	 * get all the subscribed feeds that the current user identified by subscriberId who followed
	 * with pagination
	 * @param subscriberId
	 * @param pagination
	 * @param pageSize
	 * @return
	 */
	public List<Feed> getSubscribedFeeds(String subscriberId, int pageSize, int pageNum);
	
	/**
	 * get all the subscribed feeds that the current user identified by subscriberId who followed
	 * 
	 * Note: usually we do not use this due to large data amount 
	 * @param subscriberId
	 * @return
	 */
	public List<Feed> getSubscribedFeeds(String subscriberId);
	
	
	
	/**
	 * 
	 * @param feed
	 * @param commentFeed
	 */
	public void pushFeedCommentRelation(Feed commentFeed);
	
	/**
	 * 
	 * @param feedId
	 * @return
	 */
	public List<Feed> listComments(String feedId);
	
	
	/**
	 * 
	 * @param feedId
	 */
	public void incrCommentsCount(String feedId);
	
	/**
	 * 
	 * @param feedId
	 */
	public void decrCommentsCount(String feedId);
	
	
	
	
	public int getCommentsCount(String feedId);
	/**
	 * 
	 * @param feedId
	 * @param userId
	 */
	public void favorFeed(String feedId, String userId);
	
	/**
	 * 
	 * @param feedId
	 * @param userId
	 */
	public void unFavorFeed(String feedId, String userId);
	/**
	 * 
	 * @param userId
	 * @return
	 */
	public List<Feed> getFavorFeeds(String userId);
	
	/**
	 * 
	 * @param UserId
	 * @return
	 */
	public void incrUserFeedCount(String userId);
	
	
	/**
	 * 
	 * @param UserId
	 * @return
	 */
	public void decrUserFeedCount(String userId);
	
	/**
	 * 
	 * @return
	 */
	public int getUserFeedCount(String userId);
	
	
	/**
	 * 
	 * @param feedId
	 */
	public void deleteFeed(String feedId);
	
	
}
